<?php
/**
 * Description:
 * Author: hezhizheng
 * Date: 2018/11/19
 * Time: 12:33
 * Created by Created by Panxsoft.
 */

namespace App\Http\Requests\Categories;

use App\Http\Requests\ApiRequest;

/**
 * @property string $category_id
 * @property string $type
 * Class CategoryCreateRequest
 * @package App\Http\Requests\Categories
 */
class CategoryCreateRequest extends ApiRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        $rules = [
            'category_id' => 'required|int|min:0',
            'type'        => 'sometimes|string|in:top,all',
        ];

        return $rules;
    }
}